/*
 * Module 02
 *
 */

package ua.gl.basecamp.tabachnyy.testcase;

/**
 * @author yaroslav.tabachnyy@gmail.com
 * @version 1.02
 * @date 14.02.2013
 *
 */
public class Answer implements Comparable<Answer> {
   private String stringRepresentation;
   private boolean correct;

    public Answer(String stringRepresentation) {
        this(stringRepresentation, false);
    }

    public Answer(String stringRepresentation, boolean correct) {
        this.stringRepresentation = stringRepresentation;
        this.correct = correct;
    }

    public boolean isCorrect() {
        return correct;
    }

    public String getStringRepresentation() {
        return stringRepresentation;
    }

    @Override
    public String toString() {
        return stringRepresentation;
    }

    @Override
    public int compareTo(Answer a) {
        return stringRepresentation.compareTo(a.stringRepresentation);
    }

    public boolean equals(Object obj) {
        if (obj == null)
            return false;
        if (obj == this)
            return true;
        if (!(obj instanceof Answer))
            return false;

        Answer answer = (Answer) obj;
        return (stringRepresentation.equals(answer.stringRepresentation));
    }

    public int hashCode() {
        return (stringRepresentation.hashCode());
    }
}
